﻿using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using ExtendedMvc.Common.EntityFramework;

namespace ExtendedMvc.WebTest.Model.Entities {
	[MetadataType(typeof(EntityMetadata))]
	partial class Entity : ILogicalEntity {
	}

	public class EntityMetadata {
		[ScaffoldColumn(false)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		[ReadOnly(true)]
		public object Id { get; set; }

		[Required(AllowEmptyStrings = false, ErrorMessage = "Name is required.")]
		[StringLength(240, MinimumLength = 3, ErrorMessage = "Name must have more than 3 and less than 240 characters.")]
		public object Name { get; set; }

		[StringLength(240, ErrorMessage = "Email must have less than 240 characters.")]
		[RegularExpression(@"^([a-z0-9_\+-]+)((\.[a-z0-9_\+-]+)*)@([a-z0-9]([a-z0-9-]*[a-z0-9])?)((\.([a-z0-9]([a-z0-9-]*[a-z0-9])?))*)(\.([a-z]{2,6}))$", ErrorMessage = "Invalid e-mail format.")]
		[DisplayName("E-mail")]
		[DisplayFormat(NullDisplayText = "[No e-mail informed]")]
		public object Email { get; set; }

		[DisplayName("Additional Information")]
		public object AdditionalInfo { get; set; }

		[ScaffoldColumn(false)]
		[ReadOnly(true)]
		public object Deleted { get; set; }
	}
}
